function OverviewBodyController(overviewBodyView, overviewHeader, repository) {
    this._repository = repository;
    this._headerStatus = overviewHeader.getHeaderStatus();
    this._overviewBodyView = overviewBodyView;
}

OverviewBodyController.prototype = {
    register: function() {
        var me = this;
        
        this._overviewBodyView.setCalculateTotalDaysCallback(function(){
            return me._calculateTotalDays(me._getMonthModels());
        });
        this._overviewBodyView.setCalculateActivityCallback(function(){
            return me._calculateActivity(me._getMonthModels());
        });
        this._overviewBodyView.setCalculateLocationCallback(function() {
            return me._calculateLocation(me._getMonthModels());
        });

        this._overviewBodyView.update();
    },

    _getMonthModels: function() {
        var me = this;
        var yearMonths = this._headerStatus.getYearMonthsInRange();
        return yearMonths.select(function(yearMonth) {
            return me._repository.getMonthByYearMonth(yearMonth)
        });
    },

    _calculateTotalDays: function() {
        return this._getMonthModels().sum(0, function(month, sum) {
            return sum + month.getDayCountInMonth();
        });
    },

    _calculateActivity: function() {
        var activitySummary = new ActivitySummary();
        this._getMonthModels().foreach(function(monthModel) {
            var monthActivitySummary = monthModel.getActivitySummary();
            activitySummary = activitySummary.append(monthActivitySummary);
        });
        return activitySummary;
    },

    _calculateLocation: function() {
        var locationSummary = new LocationSummary();
        this._getMonthModels().foreach(function(monthModel) {
            var monthLocationSummary = monthModel.getLocationSummary();
            locationSummary.append(monthLocationSummary);
        });
        return locationSummary;
    }
};